//
//  AlertDialog.swift
//  test-ios
//
//  Created by wyz5204 on 2023/5/18.
//

import Foundation
import UIKit


class AlertDialog {
    static func show(_ uiVC : UIViewController , title : String , array : Array<String> , _  block :  @escaping (String,Int) -> Void ){
        let alert = UIAlertController.init(title: title, message: nil, preferredStyle: .actionSheet)
        for index in 0..<array.count {
            alert.addAction(UIAlertAction.init(title: array[index], style: .default, handler: { (action) in
                block(array[index] ,index )
            }))
        }
        alert.addAction(UIAlertAction.init(title: "取消", style: .cancel, handler: nil))
        uiVC.present(alert, animated: true, completion: nil)
    }
}
